package mysql

import (
	_ "github.com/go-sql-driver/mysql"
	"github.com/jinzhu/gorm"
	"testGin/config"
)

var Db *gorm.DB
var err error

func init() {

	config := (&config.Config{}).InIt()

	loc := config.Mysql.Host
	username := config.Mysql.Username
	password := config.Mysql.Password
	dbname := config.Mysql.Dbname
	charset := config.Mysql.Charset
	Db, err = gorm.Open("mysql", username+":"+password+"@/"+dbname+"?charset="+charset+"&parseTime=True&loc="+loc)
	Db = Db.Debug()
	if err != nil{
		panic(err)
	}
}
